<?php
$ip = $_SERVER['REMOTE_ADDR'];
if( isset($_SERVER['HTTP_REFERER']) ) {
    $url_array = explode('http://', $_SERVER['HTTP_REFERER']);
    $url = explode('/', $url_array[1]);
    $url1 = $_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"];
    if($url1 != $url[0]) {
        exit('success');
    }
} else {
    exit('OK');
}
include('session.php');
include('../Config/conn.php');
$id=$_GET["id"];
$type=$_GET['type'];
if ($id!="") {
if ($type=="fq") {
    $q="delete from server where id=".$id;
	$result=mysql_query($q);
} elseif ($type=="item") {
    $q="delete from item where id=".$id;
	$result=mysql_query($q);
} elseif ($type=="item_all") {
    $var=explode(",",$id);
    foreach($var as $key=>$value){
    $q="delete from item where id=".$value;
	$result=mysql_query($q);
    }
} elseif ($type=="bag_del") {
    $pid=substr($id,0,1 );
    if ($pid == 1){
      chdir('/home/nomogaserver/nomogaserver1/logicshell');  
    }elseif($pid == 2){
      chdir('/home/nomogaserver/nomogaserver3/logicshell'); 
	}elseif($pid == 3){
      chdir('/home/nomogaserver/nomogaserver4/logicshell');  
    }
	
	$shell="./gm.sh cleargoods $id";
	exec($shell, $result, $status);
} elseif ($type=="shop") {
    $q="delete from shop where id=".$id;
	$result=mysql_query($q);
} elseif ($type=="shop_all") {
    $var=explode(",",$id);
    foreach($var as $key=>$value){
    $q="delete from shop where id=".$value;
	$result=mysql_query($q);
    }
} elseif ($type=="choujiang") {
    $q="delete from choujiang where id=".$id;
	$result=mysql_query($q);
} elseif ($type=="schoujiang_all") {
    $var=explode(",",$id);
    foreach($var as $key=>$value){
    $q="delete from choujiang where id=".$value;
	$result=mysql_query($q);
    }
} elseif ($type=="pet") {
    $q="delete from pet where id=".$id;
	$result=mysql_query($q);
} elseif ($type=="pet_all") {
    $var=explode(",",$id);
    foreach($var as $key=>$value){
    $q="delete from pet where id=".$value;
	$result=mysql_query($q);
    }
} elseif ($type=="del_user")  {
    $q="delete from game_user";
	$result=mysql_query($q);
	echo $result;
} elseif ($type=="pay")  {
    $q = "delete from pay where id=".$id;
	$result=mysql_query($q);
	echo $result;
} elseif ($type=="pay_all") {
    $var=explode(",",$id);
    foreach($var as $key=>$value){
    $q="delete from pay where id=".$value;
	$result=mysql_query($q);
    }
} elseif ($type=="user")  {
    $q="insert into game_user (user,logtime) SELECT * from (select dt_device.acct,dt_device.logtime from baibaoxiyou1.dt_device) as f";
	$result=mysql_query($q);
	echo $result;
} elseif ($type=="suoyin")  {
    $q="ALTER TABLE `game_user` ADD UNIQUE(`user`)";
	$result=mysql_query($q);
	echo $result;
} elseif ($type=="dl_del")  {
    $q="delete from user where uid=".$id;
	$result=mysql_query($q);
} elseif ($type=="dl_all")  {
    $var=explode(",",$id);
    foreach($var as $key=>$value){
    $q="delete from user where uid=".$value;
	$result=mysql_query($q);
    }
} elseif ($type=="chufa")  {
    include('../Config/config.php');
    $q = "create trigger up_user after INSERT on dt_device for each row insert into xy3.game_user (user,money,logtime) values (new.acct,0,new.logtime)";
	$result=mysql_query($q);
	echo $result;
} 
    
    
} else {
	echo"<script>alert('ID不能为空')</script>";
}

?>